package io;

import java.io.*;

public class CopyDemo {
    public static void main(String[] args) throws IOException {
        FileInputStream fis = new FileInputStream("img.png");
        FileOutputStream fos = new FileOutputStream("img_1.png");
        long start = System.currentTimeMillis();
        int d;
        long count = 0;
        while ((d = fis.read()) != -1){
            fos.write(d);
            count++;
        }
        System.out.println("复制了" + count + "个字节");
        long end = System.currentTimeMillis();
        System.out.println("复制完成");
        System.out.println("复制耗时：" + (end - start)/1000.0 + "秒");
    }
}
